/*
 * @Description:
 * @Version: 1.0
 * @Autor: lzc
 * @Date: 2022-01-04 15:03:51
 * @LastEditors: lzc
 * @LastEditTime: 2022-01-05 10:47:32
 */
/**
 ******************************************************************************
 * @file    adc.h
 * @brief   This file contains all the function prototypes for
 *          the adc.c file
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; Copyright (c) 2022 STMicroelectronics.
 * All rights reserved.</center></h2>
 *
 * This software component is licensed by ST under BSD 3-Clause license,
 * the "License"; You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                        opensource.org/licenses/BSD-3-Clause
 *
 ******************************************************************************
 */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ANALOGUART_H__
#define __ANALOGUART_H__

#ifdef __cplusplus
extern "C"
{
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "gpio.h"
#include "tim.h"

#ifdef __cplusplus
}
#endif

enum
{
    COM_START_BIT,
    COM_D0_BIT,
    COM_D1_BIT,
    COM_D2_BIT,
    COM_D3_BIT,
    COM_D4_BIT,
    COM_D5_BIT,
    COM_D6_BIT,
    COM_D7_BIT,
    COM_STOP_BIT,
};

typedef struct _AnalogUart_Data_Struct_
{
    char USART_recvData; //接收数据
    char USART_Timeout;  //超时时间（不定长接受数据）
    char USART_Rx_Done;  //接收完成标志位
    char USART_len;      //接收计数
    char USART_buf[128]; //接收缓冲区
} AnalogUart_Data_Struct_t;

extern AnalogUart_Data_Struct_t AnalogUart_Data_Struct;

void USART_Send(char *buf, char len);
void Tick_delay_us(__IO uint32_t delay);
void AnalogUart_Init_Struct(void);
void AnalogUart_EXIT_Handler(void);
void AnalogUart_IO_TIM_Handler(void);
void AnalogUart_TimeOut_TIM_Handler(void);
#endif /* __ADC_H__ */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
